/*
 * Image.cpp
 *
 *  Created on: 23. 2. 2013.
 *      Author: sjelic
 */

#include<iostream>
#include "CImg.h"
#include "image.h"

using namespace cimg_library;

image::image(char path[])
{
        CImg<float> src(path);
        int width = src.width();
        int height = src.height();
        int k;
        int i;
        int j;
        int f=0;
        unsigned char r;
        T=width*height;
        X= new float [3*T];
        for (i=0;i<2;i++)
        {
                for (j=0;j<height;j++)
                {
                        for (k=0;k<width;k++)
                        {
                                X[f]=(float)(src(k,j,0,i));
                                f++;
                        }
                }
        }
}

void image::printMatrxX()
{
        for(int i=0; i<3*T; i++)
        {
                if(i%T==0)
                {
                        std::cout<<"\n";
                }
                std::cout<<X[i]<<"  ";
        }
}
